How do I combine the two methods of cryptography, CBC cipher block and Vingenere Chiper [on hold]

Posted by Bangpe on Programmers See other posts from Programmers or by Bangpe
Published on 2014-06-10T02:11:55Z Indexed on 2014/06/10 3:41 UTC
Read the original article Hit count: 205

Filed under:
|

Code Vingenere

 static String encrypt(String text, final String key) {
            String res = "";
            text = text.toUpperCase();
            for (int i = 0, j = 0; i < text.length(); i++) {
                char c = text.charAt(i);
                if (c < 'A' || c > 'Z') continue;
                res += (char)((c + key.charAt(j) - 2 * 'A') % 26 + 'A');
                j = ++j % key.length();
            }
            return res;
        }

Code CBC Chiper

public CbcBlockCipher( BlockCipher blockCipher )
    {
    super( blockCipher.keySize(), blockCipher.blockSize() );
    this.blockCipher = blockCipher;
    iv = new byte[blockSize()];
    zeroBlock( iv );
    temp = new byte[blockSize()];
    }

© Programmers or respective owner

Related posts about java

Related posts about cryptography